#include <stdio.h>
#include <stdlib.h>
typedef unsigned char* byte_pointer;
float sum_element(float a[],unsigned length);
void show_bytes(byte_pointer start ,int len);
int show_int(int x);
void show_float(float x);
void show_pointer(void* x);
int main()
{
 
    int val=32;
int flag=0;
	printf("初始值是:32\n");
    float fval=val;
    int *pval=&val;
    flag=show_int(val);
if(!flag)
	printf("20155213的笔记本电脑是小端的\n");
else printf("20155213的笔记本电脑是大端的\n");
    //printf("%.2x\n",*(pval+2));
    show_float(fval);
    //printf("%f\n",fval);
    show_pointer(pval);
    //printf("Hello world!\n");
    return 0;
}
void show_bytes(byte_pointer start ,int len)
{
    int i;
    for(i=0;i<len;i++)
    {
        printf(" %.2x",start[i]);
    }
    printf("\n");
}
int show_int(int x){
    show_bytes((byte_pointer)&x,sizeof(int));
	if(((byte_pointer)&x)[0]==x>>24)return 1;
return 0;
}
void show_float(float x){
    show_bytes((byte_pointer)&x,sizeof(float));
}
void show_pointer(void* x){
    show_bytes((byte_pointer)&x,sizeof(4));
}
float sum_element(float a[],unsigned length)
{
    int i=0;
    float result=0;
    printf("p1=%p\n",a);
    //if(i<=length-1)printf("\n\n%u\n\n",i);
    for(i=0;i<=length-1;i++){printf("\n%f\n",a[i]);
        result+=a[i];}

        return result;
}

